<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Vue3 - 学习指南 | Will&#39;s blog</title>
    <meta name="generator" content="VuePress 1.5.4">
    <link rel="icon" href="/will/xin.ico">
    <link rel="stylesheet" href="../style/main.css">
    <meta name="description" content="斯人若彩虹，遇上方知有">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <link rel="preload" href="/will/assets/css/0.styles.b6de8ef8.css" as="style"><link rel="preload" href="/will/assets/js/app.e77fe8ad.js" as="script"><link rel="preload" href="/will/assets/js/3.19d8dd7e.js" as="script"><link rel="preload" href="/will/assets/js/1.cde8b311.js" as="script"><link rel="preload" href="/will/assets/js/18.798dabbc.js" as="script"><link rel="prefetch" href="/will/assets/js/10.3f6ba718.js"><link rel="prefetch" href="/will/assets/js/100.139e2315.js"><link rel="prefetch" href="/will/assets/js/101.48688945.js"><link rel="prefetch" href="/will/assets/js/102.065adb71.js"><link rel="prefetch" href="/will/assets/js/103.afb27929.js"><link rel="prefetch" href="/will/assets/js/104.d56b5577.js"><link rel="prefetch" href="/will/assets/js/105.8e6de207.js"><link rel="prefetch" href="/will/assets/js/106.cf8275a7.js"><link rel="prefetch" href="/will/assets/js/107.e1219958.js"><link rel="prefetch" href="/will/assets/js/108.89f471cb.js"><link rel="prefetch" href="/will/assets/js/109.860a4646.js"><link rel="prefetch" href="/will/assets/js/11.48a3ea24.js"><link rel="prefetch" href="/will/assets/js/110.4c49a0f9.js"><link rel="prefetch" href="/will/assets/js/111.b1ff0a30.js"><link rel="prefetch" href="/will/assets/js/112.6855af7b.js"><link rel="prefetch" href="/will/assets/js/113.73cc10ce.js"><link rel="prefetch" href="/will/assets/js/114.d9f95ccf.js"><link rel="prefetch" href="/will/assets/js/115.c204c90d.js"><link rel="prefetch" href="/will/assets/js/116.b6786151.js"><link rel="prefetch" href="/will/assets/js/117.c980193e.js"><link rel="prefetch" href="/will/assets/js/118.fd5f5951.js"><link rel="prefetch" href="/will/assets/js/119.2d749326.js"><link rel="prefetch" href="/will/assets/js/12.dd541a6f.js"><link rel="prefetch" href="/will/assets/js/120.c895e973.js"><link rel="prefetch" href="/will/assets/js/121.16eebc81.js"><link rel="prefetch" href="/will/assets/js/122.998e4582.js"><link rel="prefetch" href="/will/assets/js/123.487162ff.js"><link rel="prefetch" href="/will/assets/js/124.c6da26b1.js"><link rel="prefetch" href="/will/assets/js/125.4a263c66.js"><link rel="prefetch" href="/will/assets/js/126.0dc9a457.js"><link rel="prefetch" href="/will/assets/js/127.3f9cf0a9.js"><link rel="prefetch" href="/will/assets/js/128.f1b86c76.js"><link rel="prefetch" href="/will/assets/js/129.ba20315e.js"><link rel="prefetch" href="/will/assets/js/13.42b44cbf.js"><link rel="prefetch" href="/will/assets/js/130.0aa34e0b.js"><link rel="prefetch" href="/will/assets/js/131.fee81874.js"><link rel="prefetch" href="/will/assets/js/132.184d555a.js"><link rel="prefetch" href="/will/assets/js/133.15287e42.js"><link rel="prefetch" href="/will/assets/js/134.abe85c40.js"><link rel="prefetch" href="/will/assets/js/135.9ea3de85.js"><link rel="prefetch" href="/will/assets/js/136.b78a6ff1.js"><link rel="prefetch" href="/will/assets/js/137.a43d0025.js"><link rel="prefetch" href="/will/assets/js/138.19f94f16.js"><link rel="prefetch" href="/will/assets/js/139.64e33006.js"><link rel="prefetch" href="/will/assets/js/14.a6795e27.js"><link rel="prefetch" href="/will/assets/js/140.715ecf96.js"><link rel="prefetch" href="/will/assets/js/141.1ba53cc8.js"><link rel="prefetch" href="/will/assets/js/142.c524ce74.js"><link rel="prefetch" href="/will/assets/js/143.663d8f77.js"><link rel="prefetch" href="/will/assets/js/15.57ade25d.js"><link rel="prefetch" href="/will/assets/js/16.ea3d25d9.js"><link rel="prefetch" href="/will/assets/js/17.227b5567.js"><link rel="prefetch" href="/will/assets/js/19.92a956d1.js"><link rel="prefetch" href="/will/assets/js/20.58156a8f.js"><link rel="prefetch" href="/will/assets/js/21.be577f23.js"><link rel="prefetch" href="/will/assets/js/22.da032112.js"><link rel="prefetch" href="/will/assets/js/23.fe130883.js"><link rel="prefetch" href="/will/assets/js/24.73e19630.js"><link rel="prefetch" href="/will/assets/js/25.6e63b142.js"><link rel="prefetch" href="/will/assets/js/26.9ceb241f.js"><link rel="prefetch" href="/will/assets/js/27.a9b40edd.js"><link rel="prefetch" href="/will/assets/js/28.1898b904.js"><link rel="prefetch" href="/will/assets/js/29.f177f57a.js"><link rel="prefetch" href="/will/assets/js/30.119d11bc.js"><link rel="prefetch" href="/will/assets/js/31.2b5effe7.js"><link rel="prefetch" href="/will/assets/js/32.8f523225.js"><link rel="prefetch" href="/will/assets/js/33.bd743528.js"><link rel="prefetch" href="/will/assets/js/34.ebbfd9c7.js"><link rel="prefetch" href="/will/assets/js/35.fd8a4d41.js"><link rel="prefetch" href="/will/assets/js/36.7926ae95.js"><link rel="prefetch" href="/will/assets/js/37.d954ed43.js"><link rel="prefetch" href="/will/assets/js/38.ad4f1845.js"><link rel="prefetch" href="/will/assets/js/39.b08e799e.js"><link rel="prefetch" href="/will/assets/js/4.3889049d.js"><link rel="prefetch" href="/will/assets/js/40.f679097f.js"><link rel="prefetch" href="/will/assets/js/41.0399d427.js"><link rel="prefetch" href="/will/assets/js/42.8406af0a.js"><link rel="prefetch" href="/will/assets/js/43.81fbaed1.js"><link rel="prefetch" href="/will/assets/js/44.37da88a9.js"><link rel="prefetch" href="/will/assets/js/45.13ecbc23.js"><link rel="prefetch" href="/will/assets/js/46.c7219a20.js"><link rel="prefetch" href="/will/assets/js/47.582a1f3b.js"><link rel="prefetch" href="/will/assets/js/48.9582e48c.js"><link rel="prefetch" href="/will/assets/js/49.c4b6e61c.js"><link rel="prefetch" href="/will/assets/js/5.5225a481.js"><link rel="prefetch" href="/will/assets/js/50.1f4590f9.js"><link rel="prefetch" href="/will/assets/js/51.24b2997a.js"><link rel="prefetch" href="/will/assets/js/52.41560234.js"><link rel="prefetch" href="/will/assets/js/53.c187d861.js"><link rel="prefetch" href="/will/assets/js/54.f9228e97.js"><link rel="prefetch" href="/will/assets/js/55.a984b610.js"><link rel="prefetch" href="/will/assets/js/56.d4c315db.js"><link rel="prefetch" href="/will/assets/js/57.c53a2862.js"><link rel="prefetch" href="/will/assets/js/58.352c456f.js"><link rel="prefetch" href="/will/assets/js/59.8b4474e9.js"><link rel="prefetch" href="/will/assets/js/6.dabd5d34.js"><link rel="prefetch" href="/will/assets/js/60.7b0b22d1.js"><link rel="prefetch" href="/will/assets/js/61.c71acc1d.js"><link rel="prefetch" href="/will/assets/js/62.1e574112.js"><link rel="prefetch" href="/will/assets/js/63.e4a3ed80.js"><link rel="prefetch" href="/will/assets/js/64.8f0b32d3.js"><link rel="prefetch" href="/will/assets/js/65.b26a8612.js"><link rel="prefetch" href="/will/assets/js/66.6c1d63a4.js"><link rel="prefetch" href="/will/assets/js/67.b4373b3a.js"><link rel="prefetch" href="/will/assets/js/68.aa860531.js"><link rel="prefetch" href="/will/assets/js/69.48e4f511.js"><link rel="prefetch" href="/will/assets/js/7.659833f2.js"><link rel="prefetch" href="/will/assets/js/70.af7808fd.js"><link rel="prefetch" href="/will/assets/js/71.fa9ce741.js"><link rel="prefetch" href="/will/assets/js/72.e3cd206c.js"><link rel="prefetch" href="/will/assets/js/73.243cf46e.js"><link rel="prefetch" href="/will/assets/js/74.7cdb1f58.js"><link rel="prefetch" href="/will/assets/js/75.f22a8f44.js"><link rel="prefetch" href="/will/assets/js/76.05829c26.js"><link rel="prefetch" href="/will/assets/js/77.ce58ae8c.js"><link rel="prefetch" href="/will/assets/js/78.84c26697.js"><link rel="prefetch" href="/will/assets/js/79.e32dd7dd.js"><link rel="prefetch" href="/will/assets/js/8.f1a7e839.js"><link rel="prefetch" href="/will/assets/js/80.490f4009.js"><link rel="prefetch" href="/will/assets/js/81.96af5f79.js"><link rel="prefetch" href="/will/assets/js/82.719eb3e4.js"><link rel="prefetch" href="/will/assets/js/83.5ac308b4.js"><link rel="prefetch" href="/will/assets/js/84.e7a6be4a.js"><link rel="prefetch" href="/will/assets/js/85.943e06e1.js"><link rel="prefetch" href="/will/assets/js/86.9d30362b.js"><link rel="prefetch" href="/will/assets/js/87.74d9d285.js"><link rel="prefetch" href="/will/assets/js/88.c2fe652b.js"><link rel="prefetch" href="/will/assets/js/89.e879f671.js"><link rel="prefetch" href="/will/assets/js/9.c8e9dac1.js"><link rel="prefetch" href="/will/assets/js/90.5569b937.js"><link rel="prefetch" href="/will/assets/js/91.47320865.js"><link rel="prefetch" href="/will/assets/js/92.317dd9ba.js"><link rel="prefetch" href="/will/assets/js/93.26d10883.js"><link rel="prefetch" href="/will/assets/js/94.ba199252.js"><link rel="prefetch" href="/will/assets/js/95.4ce3b46e.js"><link rel="prefetch" href="/will/assets/js/96.d71e1886.js"><link rel="prefetch" href="/will/assets/js/97.a42a98b8.js"><link rel="prefetch" href="/will/assets/js/98.cf22a42b.js"><link rel="prefetch" href="/will/assets/js/99.f6738a3e.js">
    <link rel="stylesheet" href="/will/assets/css/0.styles.b6de8ef8.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar" data-v-2d5f533b><div data-v-2d5f533b><div id="loader-wrapper" class="loading-wrapper" data-v-d48f4d20 data-v-2d5f533b data-v-2d5f533b><div class="loader-main" data-v-d48f4d20><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-64685f0e data-v-2d5f533b data-v-2d5f533b><h3 class="title" style="display:none;" data-v-64685f0e data-v-64685f0e>Will's blog</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-64685f0e data-v-64685f0e><input type="password" value="" data-v-64685f0e> <span data-v-64685f0e>Konck! Knock!</span> <button data-v-64685f0e>OK</button></label> <div class="footer" style="display:none;" data-v-64685f0e data-v-64685f0e><span data-v-64685f0e><i class="iconfont reco-theme" data-v-64685f0e></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-64685f0e>vuePress-theme-reco</a></span> <span data-v-64685f0e><i class="iconfont reco-copyright" data-v-64685f0e></i> <a data-v-64685f0e><span data-v-64685f0e>Will</span>
            
          <span data-v-64685f0e>2020 - </span>
          2023
        </a></span></div></div> <div class="hide" data-v-2d5f533b><header class="navbar" data-v-2d5f533b><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/will/" class="home-link router-link-active"><img src="/will/xin.png" alt="Will's blog" class="logo"> <span class="site-name">Will's blog</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/will/" class="nav-link"><i class="iconfont reco-home"></i>
  主页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-coding"></i>
      前端
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/will/docs/note/" class="nav-link"><i class="iconfont reco-suggestion"></i>
  学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/will/docs/books/" class="nav-link"><i class="iconfont reco-npm"></i>
  阅读书籍
</a></li><li class="dropdown-item"><!----> <a href="/will/docs/article/" class="nav-link"><i class="iconfont reco-api"></i>
  质量文章
</a></li><li class="dropdown-item"><!----> <a href="/will/docs/dailyNotes/" class="nav-link"><i class="iconfont reco-suggestion"></i>
  日常笔记
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/will/categories/Vue/" class="nav-link"><i class="iconfont undefined"></i>
  Vue
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/规范编码/" class="nav-link"><i class="iconfont undefined"></i>
  规范编码
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/项目总结/" class="nav-link"><i class="iconfont undefined"></i>
  项目总结
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/Vue组件/" class="nav-link"><i class="iconfont undefined"></i>
  Vue组件
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/javaScript/" class="nav-link"><i class="iconfont undefined"></i>
  javaScript
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/工具js库/" class="nav-link"><i class="iconfont undefined"></i>
  工具js库
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/vue/" class="nav-link"><i class="iconfont undefined"></i>
  vue
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/组件/" class="nav-link"><i class="iconfont undefined"></i>
  组件
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/TypeScript/" class="nav-link"><i class="iconfont undefined"></i>
  TypeScript
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/基础知识/" class="nav-link"><i class="iconfont undefined"></i>
  基础知识
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/总结/" class="nav-link"><i class="iconfont undefined"></i>
  总结
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/日常笔记/" class="nav-link"><i class="iconfont undefined"></i>
  日常笔记
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/学习计划/" class="nav-link"><i class="iconfont undefined"></i>
  学习计划
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/css/" class="nav-link"><i class="iconfont undefined"></i>
  css
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/element/" class="nav-link"><i class="iconfont undefined"></i>
  element
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/其他/" class="nav-link"><i class="iconfont undefined"></i>
  其他
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/Vue3/" class="nav-link"><i class="iconfont undefined"></i>
  Vue3
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/数据可视化/" class="nav-link"><i class="iconfont undefined"></i>
  数据可视化
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/算法/" class="nav-link"><i class="iconfont undefined"></i>
  算法
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/面试/" class="nav-link"><i class="iconfont undefined"></i>
  面试
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/Vite/" class="nav-link"><i class="iconfont undefined"></i>
  Vite
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/uni-app/" class="nav-link"><i class="iconfont undefined"></i>
  uni-app
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/ui框架/" class="nav-link"><i class="iconfont undefined"></i>
  ui框架
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/小程序/" class="nav-link"><i class="iconfont undefined"></i>
  小程序
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/HTML/" class="nav-link"><i class="iconfont undefined"></i>
  HTML
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/CSS/" class="nav-link"><i class="iconfont undefined"></i>
  CSS
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/React.js/" class="nav-link"><i class="iconfont undefined"></i>
  React.js
</a></li></ul></div></div><div class="nav-item"><a href="/will/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      部分项目
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://github.com/zhenzhencai/FontEndInterview" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  面试指南
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="/will/docs/protests/VueUI.html" class="nav-link"><i class="iconfont reco-github"></i>
  Vue轮子
</a></li></ul></div></div><div class="nav-item"><a href="/will/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间线
</a></div><div class="nav-item"><a href="/will/docs/disorder/m1.html" class="nav-link"><i class="iconfont reco-coding"></i>
  题目汇总
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      关于我
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/willwong" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  Gitee
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://github.com/wangliangxin" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  GitHub
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="http://wpa.qq.com/msgrd?v=3&amp;uin=1418580404&amp;site=qq&amp;menu=yes" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-qq"></i>
  QQ
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-2d5f533b></div> <aside class="sidebar" data-v-2d5f533b><div class="personal-info-wrapper" data-v-ca798c94 data-v-2d5f533b><img src="/will/xin.png" alt="author-avatar" class="personal-img" data-v-ca798c94> <h3 class="name" data-v-ca798c94>
    Will
  </h3> <div class="num" data-v-ca798c94><div data-v-ca798c94><h3 data-v-ca798c94>85</h3> <h6 data-v-ca798c94>Article</h6></div> <div data-v-ca798c94><h3 data-v-ca798c94>6</h3> <h6 data-v-ca798c94>Tag</h6></div></div> <hr data-v-ca798c94></div> <nav class="nav-links"><div class="nav-item"><a href="/will/" class="nav-link"><i class="iconfont reco-home"></i>
  主页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-coding"></i>
      前端
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/will/docs/note/" class="nav-link"><i class="iconfont reco-suggestion"></i>
  学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/will/docs/books/" class="nav-link"><i class="iconfont reco-npm"></i>
  阅读书籍
</a></li><li class="dropdown-item"><!----> <a href="/will/docs/article/" class="nav-link"><i class="iconfont reco-api"></i>
  质量文章
</a></li><li class="dropdown-item"><!----> <a href="/will/docs/dailyNotes/" class="nav-link"><i class="iconfont reco-suggestion"></i>
  日常笔记
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/will/categories/Vue/" class="nav-link"><i class="iconfont undefined"></i>
  Vue
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/规范编码/" class="nav-link"><i class="iconfont undefined"></i>
  规范编码
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/项目总结/" class="nav-link"><i class="iconfont undefined"></i>
  项目总结
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/Vue组件/" class="nav-link"><i class="iconfont undefined"></i>
  Vue组件
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/javaScript/" class="nav-link"><i class="iconfont undefined"></i>
  javaScript
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/工具js库/" class="nav-link"><i class="iconfont undefined"></i>
  工具js库
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/vue/" class="nav-link"><i class="iconfont undefined"></i>
  vue
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/组件/" class="nav-link"><i class="iconfont undefined"></i>
  组件
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/TypeScript/" class="nav-link"><i class="iconfont undefined"></i>
  TypeScript
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/基础知识/" class="nav-link"><i class="iconfont undefined"></i>
  基础知识
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/总结/" class="nav-link"><i class="iconfont undefined"></i>
  总结
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/日常笔记/" class="nav-link"><i class="iconfont undefined"></i>
  日常笔记
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/学习计划/" class="nav-link"><i class="iconfont undefined"></i>
  学习计划
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/css/" class="nav-link"><i class="iconfont undefined"></i>
  css
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/element/" class="nav-link"><i class="iconfont undefined"></i>
  element
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/其他/" class="nav-link"><i class="iconfont undefined"></i>
  其他
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/Vue3/" class="nav-link"><i class="iconfont undefined"></i>
  Vue3
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/数据可视化/" class="nav-link"><i class="iconfont undefined"></i>
  数据可视化
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/算法/" class="nav-link"><i class="iconfont undefined"></i>
  算法
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/面试/" class="nav-link"><i class="iconfont undefined"></i>
  面试
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/Vite/" class="nav-link"><i class="iconfont undefined"></i>
  Vite
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/uni-app/" class="nav-link"><i class="iconfont undefined"></i>
  uni-app
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/ui框架/" class="nav-link"><i class="iconfont undefined"></i>
  ui框架
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/小程序/" class="nav-link"><i class="iconfont undefined"></i>
  小程序
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/HTML/" class="nav-link"><i class="iconfont undefined"></i>
  HTML
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/CSS/" class="nav-link"><i class="iconfont undefined"></i>
  CSS
</a></li><li class="dropdown-item"><!----> <a href="/will/categories/React.js/" class="nav-link"><i class="iconfont undefined"></i>
  React.js
</a></li></ul></div></div><div class="nav-item"><a href="/will/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      部分项目
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://github.com/zhenzhencai/FontEndInterview" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  面试指南
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="/will/docs/protests/VueUI.html" class="nav-link"><i class="iconfont reco-github"></i>
  Vue轮子
</a></li></ul></div></div><div class="nav-item"><a href="/will/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间线
</a></div><div class="nav-item"><a href="/will/docs/disorder/m1.html" class="nav-link"><i class="iconfont reco-coding"></i>
  题目汇总
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      关于我
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/willwong" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  Gitee
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="https://github.com/wangliangxin" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  GitHub
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-item"><!----> <a href="http://wpa.qq.com/msgrd?v=3&amp;uin=1418580404&amp;site=qq&amp;menu=yes" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-qq"></i>
  QQ
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></div></div> <!----></nav> <!----> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-64685f0e data-v-2d5f533b><h3 class="title" style="display:none;" data-v-64685f0e data-v-64685f0e>Vue3 - 学习指南</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-64685f0e data-v-64685f0e><input type="password" value="" data-v-64685f0e> <span data-v-64685f0e>Konck! Knock!</span> <button data-v-64685f0e>OK</button></label> <div class="footer" style="display:none;" data-v-64685f0e data-v-64685f0e><span data-v-64685f0e><i class="iconfont reco-theme" data-v-64685f0e></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-64685f0e>vuePress-theme-reco</a></span> <span data-v-64685f0e><i class="iconfont reco-copyright" data-v-64685f0e></i> <a data-v-64685f0e><span data-v-64685f0e>Will</span>
            
          <span data-v-64685f0e>2020 - </span>
          2023
        </a></span></div></div> <div data-v-2d5f533b><main class="page"><div class="page-title" style="display:none;"><h1 class="title">Vue3 - 学习指南</h1> <div data-v-3b7f5bdf><i class="iconfont reco-account" data-v-3b7f5bdf><span data-v-3b7f5bdf>Will</span></i> <i class="iconfont reco-date" data-v-3b7f5bdf><span data-v-3b7f5bdf>2022-02-12</span></i> <!----> <!----></div></div> <div class="theme-reco-content content__default" style="display:none;"><p>推荐阅读：
<a href="https://juejin.cn/post/7043986391620911117?utm_source=gold_browser_extension" target="_blank" rel="noopener noreferrer">浅学vue3<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p> <p><a href="https://mp.weixin.qq.com/s/w4n_WhbDqK4kgzxEHUWWfw" target="_blank" rel="noopener noreferrer">不要再用Vue 2的思维写Vue 3了<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p> <h2 id="组合api思维"><a href="#组合api思维" class="header-anchor">#</a> 组合api思维</h2> <p>我们在使用vue3的时候会发现很能抽出<code>hook函数</code>, 很大一部分原因在于我们在关系复用问题，其实这不正确，
好的代码，<strong>可维护性</strong>比<strong>可复用</strong>更重要。</p> <p><strong>逻辑关注点</strong>，逻辑关注点是指表达同一个业务的代码内聚到一起，这也是<strong>单一职责</strong>的指导思想，我们内聚的不应该技术类型，而是业务逻辑，因为触发代码变更的往往是业务需求，因此把相同变更理由的代码放在一起，这才不会导致散弹式修改</p> <h2 id="创建vue3-x项目"><a href="#创建vue3-x项目" class="header-anchor">#</a> 创建Vue3.x项目</h2> <ul><li>方法一： vue-cli 脚手架创建</li></ul> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>
vue create vue3-demo

// 选择第二个

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><p><img src="/will/assets/img/22-2-12.b3c31cf6.jpg" alt="p1"></p> <ul><li>方法二： vite 脚手架创建</li></ul> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>
<span class="token function">npm</span> init vite-app vue3-demo2

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><p><img src="/will/assets/img/2.01f901a9.jpg" alt="p2"></p> <h2 id="目录结构"><a href="#目录结构" class="header-anchor">#</a> 目录结构</h2> <p>1, Vite生成的Vue3目录结构和vue-cli生成的Vue2项目基本一致，入口文件同样为main.js。</p> <p>2, Vue3入口引入的不再是Vue的构造函数，而是名为createApp的工厂函数，若继续Vue2里边的写法，import Vue from 'vue' 打印出来的Vue则为undefined。也就是说Vue2里边的写法并不被兼容。creatApp(App)相当于Vue2里定义的vm，且会更轻量。</p> <h2 id=""><a href="#" class="header-anchor">#</a></h2></div> <footer class="page-edit" style="display:none;"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">9/6/2022, 3:26:36 PM</span></div></footer> <!----> <!----> <!----></main> <!----></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div><div class="kanbanniang" data-v-5775ee02><div class="banniang-container" style="display:;" data-v-5775ee02><div class="messageBox" style="right:68px;bottom:190px;display:none;" data-v-5775ee02>
      欢迎来到 Will's blog
    </div> <div class="operation" style="right:90px;bottom:40px;display:none;" data-v-5775ee02><i class="kbnfont kbn-ban-home ban-home" data-v-5775ee02></i> <i class="kbnfont kbn-ban-message message" data-v-5775ee02></i> <i class="kbnfont kbn-ban-close close" data-v-5775ee02></i> <a target="_blank" href="https://vuepress-theme-reco.recoluan.com/views/plugins/kanbanniang.html" data-v-5775ee02><i class="kbnfont kbn-ban-info info" data-v-5775ee02></i></a> <i class="kbnfont kbn-ban-theme skin" style="display:none;" data-v-5775ee02></i></div> <canvas id="banniang" width="150" height="220" class="live2d" style="right:90px;bottom:0px;opacity:1;" data-v-5775ee02></canvas></div> <div class="showBanNiang" style="display:none;" data-v-5775ee02>
    看板娘
  </div></div><div></div><canvas id="vuepress-canvas-cursor"></canvas></div></div>
    <script src="/will/assets/js/app.e77fe8ad.js" defer></script><script src="/will/assets/js/3.19d8dd7e.js" defer></script><script src="/will/assets/js/1.cde8b311.js" defer></script><script src="/will/assets/js/18.798dabbc.js" defer></script>
  </body>
</html>
